home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
LIBRARY
/
PASCALL
/
NEETVGA
/
RGB
/
GRAPHICS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-03-02
|
2KB
|
123 lines
program graphicstest;
uses
crt,
graph,fsupvga,
fernrogr,
fernando,roger;
const
intensity:byte=100;
procedure pause;
var
buff:char;
begin
repeat until keypressed;
buff:=readkey;
end;
procedure clearpalette;
var
a:byte;
palette:fullpalette;
begin
for a:=0 to 255 do
with palette[a] do begin
red:=0;
green:=0;
blue:=0;
end;
restorefullpalette(palette);
end;
procedure worker;
type
coloring=byte;
var
a:coloring;
b:integer;
begin
a:=random(229)+1;
for b:=0 to getmaxx do begin
inc(a);
if a>=231 then a:=1;
setcolor(a);
line(b,0,b,getmaxy);
end;
end;
procedure working;
var
a,b:byte;
color:prgb;
pal1,pal2,pal3:crgb;
function well(a:byte):byte;
begin
well:=trunc((a*100)/230);
end;
begin
a:=0;
for color:=R to pred(pred(W)) do begin
getcolr(color,pal1,intensity);
getcolr(succ(color),pal2,intensity);
for b:=0 to blendframes do begin
inc(a);
incrementer(pal1,pal2,b,pal3);
pal3.color:=a;
putpalettecolor(pal3);
end;
end;
end;
procedure followaround;
var
bx,by:integer;
x,y:integer;
stop:boolean;
tempc:char;
pal:crgb;
begin
bx:=1; x:=1; by:=1; y:=1;
stop:=false;
repeat
repeat
tempc:=readkey;
until tempc in [#27,'2','4','6','8'];
case tempc of
'2': if y<getmaxy-1 then inc(y) else y:=0;
'4': if x>0 then dec(x) else x:=getmaxx;
'6': if x<getmaxx then inc(x) else x:=1;
'8': if y>0 then dec(y) else y:=getmaxy-1;
#27: stop:=true;
end;
putpixel(bx,by,getpixel(bx,by+1));
getpalettecolor(getpixel(x,y),pal);
with pal do
putcolor(255,ginverse(red),ginverse(green),ginverse(blue));
putpixel(x,y,255);
bx:=x; by:=y;
until stop;
end;
procedure control;
var
originalpalette:fullpalette;
begin
storefullpalette(originalpalette);
blendframes:=9;
initializesupvga(1,'c:\tp\bgi');
clearpalette;
worker;
working;
followaround;
pause;
restorefullpalette(originalpalette);
end;
begin
control;
end.